import { createRouter, createWebHistory } from 'vue-router'
// 引入路由
import SdyHome from '@/views/SdyHome/index.vue';
import SdyCate from '@/views/SdyCategory/index.vue';
import SdyCart from '@/views/SdyCart/index.vue';
import SdySelf from '@/views/SdySelf/index.vue';
import SdyNotFond from '@/views/SdyNotFond/index.vue'
const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            // 重定向
            redirect: '/home'
        },
        {
            path: '/home',
            name: 'home',
            component: SdyHome
        },
        {
            path: '/cate',
            name: 'cate',
            component: SdyCate
        },
        {
            path: '/self',
            name: 'self',
            component: SdySelf
        },
        {
            path: '/list',
            name: 'list',
            component: () => import('@/views/SdyGoodsList/index.vue')

        },
        {
            path: '/search',
            name: 'search',
            component: () => import('@/views/SdySearch/index.vue'),
            meta: { hidFooter: true }
        },
        {
            path: '/login',
            name: 'login',
            component: () => import('@/views/Sdy-login/index.vue'),
            meta: { hidFooter: true }
        },
        {
            path: '/register',
            name: 'register',
            component: () => import('@/views/Sdy-register/index.vue'),
            meta: { hidFooter: true }
        },
        {
            path: '/notfond',
            name: 'notfond',
            component: SdyNotFond,
            meta: {
                // 为true时，底部导航栏不显示
                hidFooter: true
            }
        },
        {
            //匹配任意内容，动态路由动态匹配
            path: '/:pathMatch(.*)*',
            redirect: '/notfond'
        },
    ]
})
// 路由出口写在中间内容区
export default router
